package com.lfz.quality_effect.controller;


import com.lfz.quality_effect.model.vo.VerifyOptimizeVO;
import com.lfz.quality_effect.service.TVerifyStatisticsService;
import com.lfz.quality_effect.utils.ResultData;
import com.lfz.quality_effect.utils.ReturnCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;




@Api(tags = "速裁快审",value = "TVerifyStatisticsController")
@RestController
@RequestMapping("/api/tVerifyStatistics")
public class TVerifyStatisticsController {


    @Autowired
    private TVerifyStatisticsService tVerifyStatisticsService;

    @ApiOperation("上传速裁快审统计信息")
    @PostMapping("/uploadVerifyStatistics")
    public ResultData uploadVerifyStatistics(@RequestParam("file")MultipartFile file){
        boolean boo = tVerifyStatisticsService.uploadVerifyStatistics(file);
        if (boo){
            return ResultData.ok();
        }
        return ResultData.fail(ReturnCode.RC500.getCode(),"今日数据已存在");
    }


    @ApiOperation("速裁快审优化")
    @PostMapping("/verifyOptimize")
    public ResultData verifyOptimize(String option){
       VerifyOptimizeVO verifyOptimizeVO =  tVerifyStatisticsService.verifyOptimize(option);

        return ResultData.ok().data(verifyOptimizeVO);
    }



}
